Skip to content

Conversation

@Emmeral
Copy link
Contributor

@Emmeral Emmeral commented Dec 11, 2024

Fixes #57

Allows to use a custom SegmentAllocator when retrieving node instances from cursors and queries. This allows for using the nodes even after the cursor / query has been closed. Also it gives the caller the opportunity to clear the memory of a node without closing the cursor / query in case a lot of nodes are retrieved without closing the cursor / query.

Note: This PR also removes the cached java node object in the TreeCursor class as we do now longer control the lifetime of its native memory. I hope this is ok as recreating it (in case somebody retrieves the same node twice) should not be that expensive.

@Emmeral Emmeral force-pushed the CustomNativeMemoryScope branch from 0a6adce to f60959d Compare December 12, 2024 14:06
@Emmeral
Copy link
Contributor Author

Emmeral commented Dec 13, 2024

I implemented the requested changes. Could you please re-review @ObserverOfTime ?

@ObserverOfTime ObserverOfTime force-pushed the CustomNativeMemoryScope branch from c86f5ae to df9050d Compare February 6, 2025 07:29
@ObserverOfTime ObserverOfTime force-pushed the CustomNativeMemoryScope branch from df9050d to e7960ca Compare February 6, 2025 07:40
@ObserverOfTime ObserverOfTime merged commit b9b0a31 into tree-sitter:master Feb 6, 2025
3 checks passed
@Emmeral Emmeral deleted the CustomNativeMemoryScope branch February 7, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using a node outside of a cursors scope

2 participants